package com.web.ShoppingDemo.util;

import java.io.File;
import java.io.FilenameFilter;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component("bankUtil")
public class BankUtilImpl implements BankUtil {
	@Value("#{prop.basePath+prop.bankPath}")
	private String bankPath;
	
	/* (non-Javadoc)
	 * @see com.web.ShoppingDemo.util.BankUtil#getBankImage()
	 */
	@Override
	public String[] getBankImage(String userPath){
		if(userPath!=null){
			bankPath = userPath;
		}
		return new File(bankPath).list(new FilenameFilter() {
			
			@Override
			public boolean accept(File dir, String name) {
				//通过后缀名实现文件的过滤
				return name.endsWith(".gif");
			}
		});
	}
	
}
